package mx.com.switz.dao.impl;

import java.util.List;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.stereotype.Repository;

import mx.com.switz.dao.CarreraDao;
import mx.com.switz.dto.Carrera;

@Repository
public class CarreraDaoImpl extends JdbcDaoSupport implements CarreraDao {

	@Autowired
	public CarreraDaoImpl(DataSource dataSource){
		setDataSource(dataSource);
	}
	@Override
	public List<Carrera> selectAllCarrera() {
		// TODO Auto-generated method stub
		   String query = "select * from carrera";
	        List<Carrera> carreras = getJdbcTemplate().query(query, 
	                ParameterizedBeanPropertyRowMapper.newInstance(Carrera.class));
		return carreras;
	}

}
